The ListBox control allows easy list operations on a nested DIV structure. Here's an example using two ListBoxes for list creation:
|
value 1
value 2
value 3
value 4
value 5
|
|
|
|
|
||
Event log:
| OnSelect |
fires when an item selected
event object propertiesnone |
| OnUnselect |
fires when an item unselected
event object propertiesnone |
| OnSelectAll |
fires when an all items selected using selectall method
event object propertiesnone |
| OnUnselectAll |
fires when an all items unselected using unselectall method
event object propertiesnone |
| OnChange |
fires when items are added or removed from the ListBox
event object propertiesnone |
| elListBox.SelectAll() |
selects all items in the list
parametersnone return valuenone |
| elListBox.UnselectAll() |
unselects all items in the list
parametersnone return valuenone |
| elListBox.select(sValue) |
selects the first item found whose value is equal to sValue.
If not found nothing is selected and no error is returned.
parameterssValue Required. Value of item to select. return valuenone |
| elListBox.unselect(sValue) |
unselects the first item found whose value is equal to sValue.
If not found nothing is unselected and no error is returned.
parameterssValue Required. Value of item to unselect. return valuenone |
| elListBox.addItem(sValue, sText) |
Creates a new item in the list with the va;lue and text passed in
parameterssValue Required. Value of new item. sText Required. display text of new item. return valuenone |
| elListBox.add(xmlNodes) |
Adds items correcsponding to xml nodes passed in. Consumes xml format returned by remove()
parametersxmlNodes Required. xmlNodes with value attribute and text that will be used for new items. return valuenone |
| set xmlNodes = elListBox.remove() |
Removes all selected items and returns aml node for each one
parametersnone return valuexmlNodes xmlNodes with value attribute and text that from removed items. |
| elListBox.moveup() |
Move selected item up one place in the list. In the case
of multi-select, will either move last selected item or the first selected item
in the list.
parametersnone return valuenone |
| elListBox.movedown() |
Move selected item down one place in the list. In the case
of multi-select, will either move last selected item or the first selected item
in the list.
parametersnone return valuenone |
| selection | 'multi' or 'single', (default = single) |
| lbDisabled | Note: add this style class in addition to 'ListBox' to make the ListBox initially disabled |
|
bDisabled = elListBox.disabled
elListBox.disabled = bDisabled |
| Read-write. Returns true if the ListBox is disabled (grayed-out and removed from tab order), false otherwise. |
| set elSelected = elListBox.selected |
| Read-only. Gets currently selected element for single selection ListBox. In the case of multi-select, will either return last selected item or the first selected item in the list. |
|
sText = elListBox.text
elListBox.text = sText |
| Read-write. Gets or sets text for currently selected item for single selection ListBox. In the case of multi-select, will either set/return text for last selected item or the first selected item in the list. |
|
sValue = elListBox.value
elListBox.value = sValue |
| Read-write. Gets or sets underlying value for currently selected item for single selection ListBox. In the case of multi-select, will either set/return underlying value for last selected item or the first selected item in the list. |
<DIV CLASS='ListBox' selection='multi'> <DIV VALUE='val1'>value 1</DIV> <DIV VALUE='val2'>value 2</DIV> … <DIV VALUE='valn'>value n</DIV> <DIV>